/**
 * 根据给定的最大值生成自定义间距映射, 单位为rem
 * 以1440为设计稿，1440的fontsize是10，所以这边要除10转成rem
 * @param max 映射表最大值
 * @returns 自定义间距值映射表
 */
const generateUnits = (max = 300, sysbol = "px") => {
  let res = {};
  Array.from({ length: max }, (_, i) => {
    res[i] = `${i}${sysbol}`;
  });
  return res;
};

/** @type {import('tailwindcss').Config} */
export default {
  content: ["./public/index.html", "./src/**/*.{html,js,ts,jsx,tsx,vue}"],
  // 初始化样式功能(normalize), 小程序标签名不一样, 故而禁用
  corePlugins: { preflight: false },
  theme: {
    extend: {
      flexGrow: generateUnits(100, ""),
      backdropBlur: generateUnits(),
      backgroundImage: {},
      zIndex: { 1: "1", 100: "100", 999: "999" },
      scale: { 66: "0.66" },
      spacing: generateUnits(1440),
      width: generateUnits(1440),
      lineHeight: generateUnits(),
      fontSize: generateUnits(120),
      borderWidth: generateUnits(),
      borderRadius: generateUnits(),
      gap: generateUnits(),
      colors: {
        e2f4ff: "rgb(var(--lof-color-f4f7f9) / <alpha-value>)",
        f2f2f2: "rgb(var(--lof-color-f2f2f2) / <alpha-value>)",
        333333: "rgb(var(--lof-color-333333) / <alpha-value>)",
        666666: "rgb(var(--lof-color-666666) / <alpha-value>)",
        999999: "rgb(var(--lof-color-999999) / <alpha-value>)",
        "0970ff": "rgb(var(--lof-color-0970ff) / <alpha-value>)",
        f5f8fa: "rgb(var(--lof-color-f5f8fa) / <alpha-value>)",
        "889aa4": "rgb(var(--lof-color-889aa4) / <alpha-value>)",
        f8f9fb: "rgb(var(--lof-color-f8f9fb) / <alpha-value>)",
        cccccc: "rgb(var(--lof-color-cccccc) / <alpha-value>)",
        fafafa: "rgb(var(--lof-color-fafafa) / <alpha-value>)",
        d5d7da: "rgb(var(--lof-color-d5d7da) / <alpha-value>)",
        "accent-color": "var(--el-color-primary)",
      },
    },
  },
};
